package com.chenxingnet.service;

import javax.annotation.Resource;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import com.chenxingnet.dao.TradingRecordDAO;
import com.chenxingnet.dto.*;

@Service("tradingRecordService")
@Transactional(rollbackFor=Exception.class)
@SuppressWarnings("all")
public class TradingRecordService{
	@Resource(name="tradingRecordDAO")
	private TradingRecordDAO tradingRecordDAO = null;
	
	public void test(){
		System.out.println(tradingRecordDAO.findByProperty(new HashMap()));
		System.out.println("TEST SUCCESS!!!");
	}
	
	public void create(TradingRecord entity){
		tradingRecordDAO.insert(entity);
	}
	
	public void update(TradingRecord entity){
		tradingRecordDAO.update(entity);
	}
	
	public void delete(Integer trid){
		tradingRecordDAO.delete(trid);
	}
	
	public TradingRecord findById(Integer trid){
		return tradingRecordDAO.findById(trid);
	}
	
	public List<Map> findByProperty(Map params){
		return tradingRecordDAO.findByProperty(params);
	}
	
	public Long countByProperty(Map params){
		return tradingRecordDAO.countByProperty(params);
	}
	
	public static void main(String[] args) {
		ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
		TradingRecordService bean = (TradingRecordService)ctx.getBean("tradingRecordService");
		bean.test();
	}
	
}
